// @ts-ignore
/* eslint-disable */
import request from "@/utils/http";

/** 查询全部租户 GET /api/tenant */
export async function getTenantsQuery(options?: { [key: string]: any }) {
  return request<Api.Result1List1TenantDetail>("/api/tenant", {
    method: "GET",
    ...(options || {}),
  });
}

/** 创建租户 POST /api/tenant */
export async function createTenant(
  body: Api.CreateTenantCommand,
  options?: { [key: string]: any }
) {
  return request<Api.Result1String>("/api/tenant", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

/** 根据ID查询租户 GET /api/tenant/${param0} */
export async function getTenantById(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: Api.getTenantByIdParams,
  options?: { [key: string]: any }
) {
  const { id: param0, ...queryParams } = params;
  return request<Api.Result1TenantDetail>(`/api/tenant/${param0}`, {
    method: "GET",
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 激活租户 POST /api/tenant/${param0}/activate */
export async function activateTenant(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: Api.activateTenantParams,
  options?: { [key: string]: any }
) {
  const { id: param0, ...queryParams } = params;
  return request<Api.Result1ActivateTenantResponse>(
    `/api/tenant/${param0}/activate`,
    {
      method: "POST",
      params: { ...queryParams },
      ...(options || {}),
    }
  );
}

/** 分配租户权限 POST /api/tenant/${param0}/assign/permission */
export async function assignPermissionToTenant(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: Api.assignPermissionToTenantParams,
  body: Api.AssignPermissionToTenantCommand,
  options?: { [key: string]: any }
) {
  const { id: param0, ...queryParams } = params;
  return request<Api.Result1Boolean>(
    `/api/tenant/${param0}/assign/permission`,
    {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
      },
      params: { ...queryParams },
      data: body,
      ...(options || {}),
    }
  );
}

/** 禁用租户 POST /api/tenant/${param0}/deactivate */
export async function disableTenant(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: Api.disableTenantParams,
  options?: { [key: string]: any }
) {
  const { id: param0, ...queryParams } = params;
  return request<Api.Result1DisableTenantResponse>(
    `/api/tenant/${param0}/deactivate`,
    {
      method: "POST",
      params: { ...queryParams },
      ...(options || {}),
    }
  );
}

/** 查询租户权限 POST /api/tenant/${param0}/permission */
export async function getTenantPermissionById(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: Api.getTenantPermissionByIdParams,
  body: Api.GetTenantPermissionByIdQuery,
  options?: { [key: string]: any }
) {
  const { id: param0, ...queryParams } = params;
  return request<Api.Result1IEnumerable1Nullable1Guid>(
    `/api/tenant/${param0}/permission`,
    {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
      },
      params: { ...queryParams },
      data: body,
      ...(options || {}),
    }
  );
}

/** 分页查询租户 GET /api/tenant/page */
export async function queryTenants(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: Api.queryTenantsParams,
  options?: { [key: string]: any }
) {
  return request<Api.Result1PaginatedData1TenantDetail>("/api/tenant/page", {
    method: "GET",
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 根据名称查询租户 GET /api/tenant/search/${param0} */
export async function getTenantByName(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: Api.getTenantByNameParams,
  options?: { [key: string]: any }
) {
  const { name: param0, ...queryParams } = params;
  return request<Api.Result1TenantResponse>(`/api/tenant/search/${param0}`, {
    method: "GET",
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 升级租户订阅 POST /api/tenant/upgrade */
export async function upgradeSubscription(
  body: Api.UpgradeSubscriptionCommand,
  options?: { [key: string]: any }
) {
  return request<Api.Result1UpgradeSubscriptionResponse>(
    "/api/tenant/upgrade",
    {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
      },
      data: body,
      ...(options || {}),
    }
  );
}
